<include file="Public/header" />
<title>我的桌面</title>
</head>
<body>
<div class="pd-20">

		<table class="table table-border table-bordered table-hover table-bg" style="margin-top:20px;">
		<thead>
			<tr>
				<th scope="col" colspan="16">产品列表</th>
			</tr>
			<tr class="text-c">
				<th width="40">ID</th>
				<th width="40">单号</th>
				<th width="40">申请部门</th>
				<th width="100">批次</th>
				<th width="40">申请人</th>
				<th width="40">制单人</th>
				<th width="40">入库仓库</th>
				<th width="40">产品名称</th>
				<th width="40">产品规格</th>
				<th width="40">料号</th>
				<th width="40">产品编码</th>
				<th width="40">计划数量</th>
				<th width="40">主单位</th>
				<th width="40">生产周期要求</th>
				<th width="40">申请摘要</th>

				<th width="40">备注</th>
			</tr>
		</thead>
		<tbody>
			<tr class="text-c">
				<input  name='gid' type="hidden" style="width:80px;" value="<{$detail['id']}>"/>
				<td><{$detail.id}><input type="hidden"   name="list_id" value="<{$detail.id}>" ></td>
				<td><{$detail.purchasing_no}></td>
				<td>
					<select  class="input-text" id="section_no" name="section_no">
						<option value="0">请选择</option>
						<volist name="section_list" id="vo">
							<option value="<{$vo.no}>" <if condition="$vo['no'] eq $detail['section_no']">selected</if>><{$vo.name}></option>
						</volist>
					</select>
				</td>
				<td><{$detail.batch_no}></td>
				<td>
					<select  class="input-text people_purchasing_no" id="people_purchasing_no" name="people_purchasing_no">
						<option value="0">请选择</option>
						<volist name="personnel_list" id="vo">
							<option value="<{$vo.no}>" <if condition="$vo['no'] eq $detail['people_purchasing_no']">selected</if>><{$vo.name}></option>
						</volist>
					</select>
				</td>
				<td>
					<select  class="input-text people_make_no" id="people_make_no" name="people_make_no">
							<option value="0">请选择</option>
							<volist name="personnel_list" id="vo">
								<option value="<{$vo.no}>" <if condition="$vo['no'] eq $detail['people_make_no']">selected</if>><{$vo.name}></option>
							</volist>
						</select>
				</td>
				<td>
					<select  class="input-text inbound_warehouse_code" id="inbound_warehouse_code" name="inbound_warehouse_code">
							<option value="0">请选择</option>
							<volist name="warehouse_list" id="vo">
								<option value="<{$vo.warehouse_code}>" <if condition="$vo['warehouse_code'] eq $detail['inbound_warehouse_code']">selected</if>><{$vo.name}></option>
							</volist>
						</select>
				</td>
				<td>
					<input type="text"  class="input-text" name="pro_name" value="<{$detail.pro_name}>" >
				</td>
				<td>
					<input type="text"  class="input-text" name="pro_spec" value="<{$detail.pro_spec}>" >
				</td>
				<td>
					<input type="text"  class="input-text" name="source_no" value="<{$detail.source_no}>" >
				</td>
				<td>
					<input type="text"  class="input-text" name="pro_no" value="<{$detail.pro_no}>" >
				</td>
				<td>
					<input type="text" class="input-text"  placeholder="计划数量" id="pro_num_plan" name="pro_num_plan" value="<{$detail.pro_num_plan}>" >
				</td>
				<td>
				<select  class="input-text unit1" id="unit1" name="unit1">
								<option value="0">请选择</option>
								<volist name="unit_list" id="vo">
									<option value="<{$vo.unit_no}>" <if condition="$vo['unit_no'] eq $detail['unit1']">selected</if>><{$vo.unit_name}></option>
								</volist>
							</select>
				</td>
				<td>
					<input type="text" class="input-text"  placeholder="生产周期要求" id="product_weeks" name="product_weeks"  value="<{$detail.product_weeks}>" >
				</td>
				<td>
					<input type="text" class="input-text"  placeholder="申请摘要" id="product_marks" name="product_marks"  value="<{$detail.product_marks}>" >
				</td>
				<td>
					<input type="text" class="input-text"  placeholder="备注" id="mark" name="mark"  value="<{$detail.mark}>" >
				</td>
			</tr>
			<volist name="byproduct_list" id="vs">
				<tr class="text-c">
				<td><{$vs.id}>副<input type="hidden"   name="list_id" value="<{$vs.id}>" ></td>
				<td><{$detail.purchasing_no}></td>
				<td>

						<volist name="section_list" id="vo">
							<if condition="$vo['no'] eq $detail['section_no']"><{$vo.name}></if>
						</volist>
					</select>
				</td>
				<td><{$detail.batch_no}></td>
				<td>
						<volist name="personnel_list" id="vo">
							<if condition="$vo['no'] eq $detail['people_purchasing_no']"><{$vo.name}></if>
						</volist>
				</td>
				<td>
							<volist name="personnel_list" id="vo">
								<if condition="$vo['no'] eq $detail['people_make_no']"><{$vo.name}></if>
							</volist>
				</td>
				<td>
							<volist name="warehouse_list" id="vo">
								<if condition="$vo['warehouse_code'] eq $detail['inbound_warehouse_code']"><{$vo.name}></if>
							</volist>
				</td>
				<td>
					<input type="text"  class="input-text" name="pro_name" value="<{$vs.pro_name}>" >
				</td>
				<td>
					<input type="text"  class="input-text" name="pro_spec" value="<{$vs.pro_spec}>" >
				</td>
				<td>
					<input type="text"  class="input-text" name="source_no" value="<{$vs.source_no}>" >
				</td>
				<td>
					<input type="text"  class="input-text" name="pro_no" value="<{$vs.pro_no}>" >
				</td>
				<td>
					<input type="text" class="input-text"  placeholder="计划数量" id="pro_num_plan" name="pro_num_plan" value="<{$vs.pro_num_plan}>" >
				</td>
				<td>
				<select  class="input-text unit1" id="unit1" name="unit1">
								<option value="0">请选择</option>
								<volist name="unit_list" id="vo">
									<option value="<{$vo.unit_no}>" <if condition="$vo['unit_no'] eq $vs['unit1']">selected</if>><{$vo.unit_name}></option>
								</volist>
							</select>
				</td>
				<td>
					<input type="text" class="input-text"  placeholder="生产周期要求" id="product_weeks" name="product_weeks"  value="<{$vs.product_weeks}>" >
				</td>
				<td>
					<input type="text" class="input-text"  placeholder="申请摘要" id="product_marks" name="product_marks"  value="<{$vs.product_marks}>" >
				</td>
				<td>
					<input type="text" class="input-text"  placeholder="备注" id="mark" name="mark"  value="<{$vs.mark}>" >
				</td>
			</tr>
			</volist>
		</tbody>
	</table>
	
	<button onclick="admin_open('添加原料','<{:U('goods',array('id'=>$detail['id'],'goods_cate'=>2))}>','','1000','600')" class="btn btn-primary">
	添加原料</button>
	<button onclick="admin_open('添加辅料','<{:U('goods',array('id'=>$detail['id'],'goods_cate'=>3))}>','','1000','600')" class="btn btn-primary">
	添加辅料</button>
	<input type="button" class="btn btn-primary radius mt" id="bedit" value="修改">
	<table class="table table-border table-bordered table-hover table-bg" style="margin-top:20px;">
		<thead>
			<tr>
				<th scope="col" colspan="13">原料列表</th>
			</tr>
			<tr class="text-c">
				<th width="40">ID</th>
				<th width="40">原料编码</th>
				<th width="40">原料名称</th>
				<th width="100">账册编码</th>
				<th width="40">料号</th>
				<th width="40">规格</th>
				<th width="40">币制</th>
				<th width="40">单价</th>
				<th width="40">主单位</th>
			</tr>
		</thead>
		<tbody>
			<volist name="list" id="vo">
			<tr class="text-c">
			 <input  name='gid' type="hidden" style="width:80px;" value="<{$vo['id']}>"/>
				<td><{$vo.id}></td>
				<td>
					<input  name='goods_no' type="hidden" style="width:80px;" value="<{$vo['goods_no']}>"/>
				<{$vo.goods_no}>
				</td>
				<td><{$vo.goods_name}></td>
				<td><{$vo.manua_id}></td>
				<td><{$vo.source_no}></td>
				<td>
					 <input  name='goods_spec' type="hidden" style="width:80px;" value="<{$vo['goods_spec']}>"/><{$vo['goods_spec']}>
				</td>
				<td><{$vo.currency_name}></td>
				<td>
					 <input  name='price' type="hidden" style="width:80px;" value="<{$vo['price']}>"/><{:round($vo['price'],2)}>
				</td>
				<td>
					 <{$vo.unit1_name}>
				</td>
			</tr>
			</volist>
		</tbody>
	</table>
	<table class="table table-border table-bordered table-hover table-bg" style="margin-top:20px;">
		<thead>
			<tr>
				<th scope="col" colspan="13">辅料列表</th>
			</tr>
			<tr class="text-c">
				<th width="40">ID</th>
				<th width="40">辅料编码</th>
				<th width="40">辅料名称</th>
				<th width="100">账册编码</th>
				<th width="40">料号</th>
				<th width="40">规格</th>
				<th width="40">币制</th>
				<th width="40">单价</th>
				<th width="40">主单位</th>
			</tr>
		</thead>
		<tbody>
			<volist name="list_f" id="vo">
			<tr class="text-c">
				<td><{$vo.id}></td>
				<td>
					<{$vo.goods_no}>
				</td>
				<td><{$vo.goods_name}></td>
				<td><{$vo.manua_id}></td>
				<td><{$vo.source_no}></td>
				<td>
					 <{$vo['goods_spec']}>
				</td>
				<td><{$vo.currency_name}></td>
				<td>
					<{:round($vo['price'],2)}>
				</td>
				<td>
					<{$vo.unit1_name}>
				</td>
			</tr>
			</volist>
		</tbody>
	</table>
	
<div class="pages">
<{$page}>
</div>
</div>
<include file="Public/footer" />
<include file="Public/footer_js" />
<script type="text/javascript">
    $(function(){
		/*保存计划入库单数据*/
        $("#bedit").click(function(){
			
			for(var i=0;i<$('input[name=pro_name]').length;i++){
				if(i==0){
					var list_id=$('input[name=list_id]').eq(i).val();
					var section_no=$('input[name=section_no]').eq(i).val();
					var people_purchasing_no=$('.people_purchasing_no').eq(i).val();
					var people_make_no=$('.people_make_no').eq(i).val();
					var inbound_warehouse_code=$('.inbound_warehouse_code').eq(i).val();
					
					var pro_name=$('input[name=pro_name]').eq(i).val();
					var pro_spec=$('input[name=pro_spec]').eq(i).val();
					var source_no=$('input[name=source_no]').eq(i).val();
					var pro_no=$('input[name=pro_no]').eq(i).val();
					var pro_num_plan=$('input[name=pro_num_plan]').eq(i).val();
					
					var unit1=$('.unit1').eq(i).val();
					var product_weeks=$('input[name=product_weeks]').eq(i).val();
					var product_marks=$('input[name=product_marks]').eq(i).val();
					var mark=$('input[name=mark]').eq(i).val();
					$.ajax({
						type: 'POST',
						data: {
								id:<{:I('id')}>,
								section_no: section_no,
								people_make_no:people_make_no,
								people_purchasing_no:people_purchasing_no,
								inbound_warehouse_code:inbound_warehouse_code,
								pro_name: pro_name,
								pro_spec: pro_spec,
								source_no: source_no,
								pro_no:pro_no,
								pro_num_plan: pro_num_plan,
								unit1:unit1,
								product_weeks:product_weeks,
								product_marks:product_marks,
								mark:mark,
								for_id:1
							  },
						url: "<{:U('edt_view')}>",
						success:function(data){
							layer.msg(data.info,function(){
								if(data.status==0){
									return false;
								}
							});
						}
					})
				}else{
					var list_id=$('input[name=list_id]').eq(i).val();
					var pro_name=$('input[name=pro_name]').eq(i).val();
					var pro_spec=$('input[name=pro_spec]').eq(i).val();
					var source_no=$('input[name=source_no]').eq(i).val();
					var pro_no=$('input[name=pro_no]').eq(i).val();
					var pro_num_plan=$('input[name=pro_num_plan]').eq(i).val();
					
					var unit1=$('.unit1').eq(i).val();
					var product_weeks=$('input[name=product_weeks]').eq(i).val();
					var product_marks=$('input[name=product_marks]').eq(i).val();
					var mark=$('input[name=mark]').eq(i).val();
					$.ajax({
						type: 'POST',
						data: {
								id:list_id,
								pro_name: pro_name,
								pro_spec: pro_spec,
								source_no: source_no,
								pro_no:pro_no,
								pro_num_plan: pro_num_plan,
								unit1:unit1,
								product_weeks:product_weeks,
								product_marks:product_marks,
								mark:mark,
								for_id:2
							  },
						url: "<{:U('edt_view')}>",
						success:function(data){
							layer.msg(data.info,function(){
								if(data.status==0){
									return false;
								}
							});
						}
					})
				}

			}
        });
    })

</script>
</body>
</html>
</html>